<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <h1 id="title">这是我的标题</h1>
    <button onclick="changeTitle()">按钮</button>
    <button onclick="sendMsg()">调用鸿蒙的方法</button>
    <button onclick="openPhoto()">打开相册</button>
    <button onclick="callBackMethods()">测试调用方法后通知结果</button>
    <h1 id="res"></h1>
    <script>
        function changeTitle(){
            const titleEle = document.getElementById('title')
            titleEle.innerText = '改名字'
        }
        function sendMsg(){
            window.hm.saiHi()
        }
        function openPhoto(){
            window.hm.openPhoto(2)
        }
        function callBackMethods(){
            const resEle = document.getElementById('res')
            window.hm.callBackMethods('测试方法',(res) => {
                   resEle.innerText = res
            })
        }
    </script>
</body>
</html>